/*
 * TextUtils.h
 *
 *  Created on: 2013.01.11.
 *      Author: Thg
 */

#ifndef TEXTUTILS_H_
#define TEXTUTILS_H_

#include <IL/il.h>


class TextUtils
{
public:
	static bool init();
	TextUtils();
	void print(int x, int y, const char* str, ...);
	void setSize(float size);
	void setColor(float r, float g, float b, float a);
	void setShrink(int pixelAmmount);

private:
	static bool initialized;
	static ILuint mImage;
	float mFontSize;
	float mFontColor[4];
	int mShrink;
};

class FrameCounter
{
public:
	static FrameCounter& getInstance(int w, int h)
	{
		// Instantiated on first use.
		static FrameCounter instance(w, h); // Guaranteed to be destroyed.
		return instance;
	}

	virtual ~FrameCounter();
	void countAndDisplay();

private:
	FrameCounter();
	FrameCounter(int, int);
	FrameCounter(FrameCounter const&);    // Don't implement
	void operator=(FrameCounter const&); // Don't implement
	void setOrthographicProjection();
	void resetPerspectiveProjection();
	void renderBitmapString(float x, float y, const char* str);

private:
	int mScreenResX, mScreenResY;
	int mFrame;
	int mTimebase;
	char mFps[30];
	TextUtils text;
};

#endif /* TEXTUTILS_H_ */
